:root {
  --xwindow-color-primary: #ebeef0;
  --xwindow-color-danger: #e81123;
  --xwindow-border-radius: 6px;
  --xwindow-logo-width: 38px;

  --xwindow-header-bg-color: var(--xwindow-color-primary);
  --xwindow-header-color: #333;
  --xwindow-header-height: 31px;
  --xwindow-header-font-size: 14px;

  --xwindow-body-bg-color: #fff;
  --xwindow-border-color: var(--xwindow-color-primary);
  --xwindow-border-highlight-color: var(--xwindow-color-primary);

  --xwindow-box-shadow: 1px 1px 18px rgba(0, 0, 0, 0.2);
  --xwindow-mask-bg-color: rgba(0, 0, 0, 0.15);

  --xwindow-tabs-border-color: #dadada;
  --xwindow-tabs-font-size: 13px;
  --xwindow-tabs-min-width: 72px;
  --xwindow-tabs-border-radius: 4px 4px 0 0;
}

.window {
  box-sizing: border-box;
  position: fixed;
  box-shadow: var(--xwindow-box-shadow);
  border-radius: var(--xwindow-border-radius);
}

:global(.xwindow-is-transition) .window {
  transition-property: top, left, width, height;
  transition-duration: 0.15s;
  transition-timing-function: ease-in-out;
}

.dragging,
.resizing {
  transition: none;
}

.maximize {
  top: 0 !important;
  left: 0 !important;
  width: 100vw !important;
  height: 100vh !important;
  border-radius: 0 !important;
}

.focused {
  border-color: var(--xwindow-border-highlight-color);

  .header,
  .tabsHeader {
    background-color: var(--xwindow-header-bg-color);
    color: var(--xwindow-header-color);
  }

  .menu {
    color: var(--xwindow-header-color);
  }

  .logo {
    color: var(--xwindow-header-color);
  }
}

.main {
  position: relative;
  z-index: 8;
  height: 100%;
}

.init {
  visibility: hidden;
  z-index: -9999;
  opacity: 0;
  pointer-events: none;
  transition: none;
}

.header {
  background-color: #fff;
  line-height: 20px;
  cursor: default;

  display: flex;
  flex-flow: row nowrap;
  align-items: center;
  border: 1px solid var(--xwindow-border-color);
  border-bottom: none;
  border-radius: var(--xwindow-border-radius) var(--xwindow-border-radius) 0 0;
  font-size: var(--xwindow-header-font-size);
}

.title {
  box-sizing: border-box;
  font-weight: 600;
  flex: 1;
  width: 0;
  height: var(--xwindow-header-height);
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
  padding: 6px 10px 6px 0;
  line-height: 20px;
}

.menus {
  display: flex;
  flex-flow: row nowrap;
  align-items: center;
}

.body {
  flex: 1;
  overflow: auto;
  background-color: var(--xwindow-body-bg-color);
  border-radius: var(--xwindow-border-radius);
  border: 1px solid var(--xwindow-border-color);
  border-top: none;
}

:global(.xwidow-is-simplewindow) .body {
  border-radius: 0 0 var(--xwindow-border-radius) var(--xwindow-border-radius);
}

.footer {
  background-color: #f5f5f5;
  height: 30px;
  padding: 0 10px;
  line-height: 30px;
}

.menu {
  composes: global(xwindow-is-menu);

  position: relative;
  border: none;
  padding: 0;
  margin: 0;
  background-color: transparent;
  outline: none;
  width: 45px;
  height: var(--xwindow-header-height);
  text-align: center;
  border-radius: 0px;
  transition:
    color ease 0.15s,
    background-color ease 0.15s;

  &::after {
    content: '';
    position: absolute;
    top: 0;
    right: 0;
    bottom: 0;
    left: 0;
    background-color: #fff;
    opacity: 0;
    z-index: 1;
    transition: all ease 0.15s;
  }

  &:hover::after {
    background-color: #000;
    opacity: 0.1;
  }

  &:last-child:hover::after {
    border-radius: 0 var(--xwindow-border-radius) 0 0;
  }

  &:focus {
    outline: none;
  }

  svg {
    display: block;
    width: 14px;
    height: 14px;
    margin: 0 auto;
    fill: currentColor;
    position: relative;
    z-index: 2;
  }
}

.maximize .menu:last-child:hover::after {
  border-radius: 0 !important;
}

.maximize .header {
  border-radius: 0 !important;
  border-top: none !important;
  border-left: none !important;
  border-right: none !important;
}

.maximize .body {
  border-radius: 0 !important;
  border-bottom: none !important;
  border-left: none !important;
  border-right: none !important;
}

.closeMenu {
  composes: menu;

  &:hover {
    color: #fff;
  }

  &:hover::after {
    background-color: var(--xwindow-color-danger);
    opacity: 1;
  }
}

.pinMenu {
  composes: menu;

  svg {
    transform: rotate(-45deg);
  }
}

.logo {
  width: var(--xwindow-logo-width);
  color: var(--xwindow-header-color);

  svg {
    display: block;
    width: 18px;
    height: 18px;
    margin: 0 auto;
    fill: currentColor;
  }
}

.resizeBar {
  position: absolute;
  z-index: 9;
  user-select: none;
}

.resizeTop,
.resizeBottom {
  composes: resizeBar;
  left: 1px;
  right: 1px;
  height: 5px;
  cursor: ns-resize;
}

.resizeTop {
  top: -5px;
}

.resizeBottom {
  bottom: -5px;
}

.resizeRight,
.resizeLeft {
  composes: resizeBar;
  top: 1px;
  bottom: 1px;
  width: 5px;
  cursor: ew-resize;
}

.resizeLeft {
  left: -5px;
}

.resizeRight {
  right: -5px;
}

.resizeTopLeft,
.resizeBottomLeft,
.resizeTopRight,
.resizeBottomRight {
  composes: resizeBar;
  width: 6px;
  height: 6px;
}

.resizeTopLeft {
  left: -5px;
  top: -5px;
  cursor: nwse-resize;
}

.resizeBottomLeft {
  left: -5px;
  bottom: -5px;
  cursor: nesw-resize;
}

.resizeTopRight {
  right: -5px;
  top: -5px;
  cursor: nesw-resize;
}

.resizeBottomRight {
  right: -5px;
  bottom: -5px;
  cursor: nwse-resize;
}

.mask {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  left: 0;
  background-color: var(--xwindow-mask-bg-color);
}

.simpleWindow {
  height: 100%;
  display: flex;
  flex-flow: column nowrap;
}

.simpleWindow .body {
  border-top-left-radius: 0;
  border-top-right-radius: 0;
}

.simpleWindowHeaderMenu {
  position: relative;
  border: none;
  margin: 0;
  background-color: transparent;
  outline: none;
  min-width: 52px;
  height: var(--xwindow-header-height);
  text-align: center;
  border-radius: 0px;
  padding: 0 12px;
  transition:
    color ease 0.15s,
    background-color ease 0.15s;

  &::after {
    content: '';
    position: absolute;
    top: 0;
    right: 0;
    bottom: 0;
    left: 0;
    background-color: #fff;
    opacity: 0;
    z-index: 1;
    transition: all ease 0.15s;
  }

  &:hover::after {
    background-color: #000;
    opacity: 0.1;
  }
}

.loading {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 999;
  background-color: #fff;

  display: flex;
  flex-flow: row nowrap;
  align-items: center;
  justify-content: center;
}

.loader {
  width: fit-content;
  font-size: 24px;
  padding-bottom: 8px;
  background: linear-gradient(currentColor 0 0) 0 100%/0% 2px no-repeat;
  animation: loaderAnimation 2s linear infinite;
}

.loader:before {
  content: attr(data-text);
}

@keyframes loaderAnimation {
  to {
    background-size: 100% 2px;
  }
}

.tabsWindow {
  height: 100%;
  display: flex;
  flex-flow: column nowrap;
}

.tabsTitle {
  margin: 0 16px 0 4px;
  font-weight: 700;
  line-height: 20px;
  flex-shrink: 0;
  font-size: var(--xwindow-header-font-size);
}

.tabsHeader {
  background-color: #fff;
  line-height: 20px;
  cursor: default;

  display: flex;
  flex-flow: row nowrap;
  align-items: flex-end;
  border: 1px solid var(--xwindow-border-color);
  border-bottom-color: var(--xwindow-tabs-border-color);
  border-radius: var(--xwindow-border-radius) var(--xwindow-border-radius) 0 0;
}

.tabsMain {
  padding-top: 4px;
  padding-left: 10px;
  display: flex;
  flex-flow: row nowrap;
  align-items: center;

  flex: 1;
  flex-shrink: 0;
  margin-right: 8px;
}

.tabs {
  display: flex;
  flex-flow: row nowrap;

  height: 28px;
  user-select: none;

  flex: 1;
  width: 0;
  overflow: hidden;
  margin-bottom: -1px;
}

.tab {
  position: relative;
  min-width: var(--xwindow-tabs-min-width);
  height: 28px;
  border-radius: var(--xwindow-tabs-border-radius);
  text-align: center;
  line-height: 27px;
  border: 1px solid transparent;
  transition: all ease 0.12s;
  box-sizing: border-box;
  padding: 0 8px;
  transition: background-color ease 0.15s;
  font-size: var(--xwindow-tabs-font-size);
}

.tab:not(.disabled):hover {
  background-color: #fff;
  border-top-color: var(--xwindow-tabs-border-color);
  border-left-color: var(--xwindow-tabs-border-color);
  border-right-color: var(--xwindow-tabs-border-color);
}

.tab + .tab {
  margin-left: 1px;
}

.tab:first-child::before {
  content: '';
  position: absolute;
  left: -1px;
  top: 4px;
  bottom: 4px;
  border-left: 1px solid var(--xwindow-tabs-border-color);
}

.tab.active {
  background-color: #fff;
  border-top-color: var(--xwindow-tabs-border-color);
  border-left-color: var(--xwindow-tabs-border-color);
  border-right-color: var(--xwindow-tabs-border-color);
  border-bottom-color: #fff;
}

.tab.disabled {
  cursor: not-allowed;
  opacity: 0.75;
}

.tabsWindow .body {
  border-top-left-radius: 0;
  border-top-right-radius: 0;
}
